# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo09
# Description:
# Author:       98745
# Date:         2019/3/2
#-------------------------------------------------------------------------------

def add(*n):
    r=0
    for i in n:
        r+=i
    return  r
print(add(1,2,3,4,5))
print('------------')
def cal(t,*n):
    r=0
    if t=='add':
        for i in n:
            r += i
        return r
    if t=='sub':
        r=n[0]
        for i in range(1,len(n)):
            r-=n[i]
        return n
    if t=='mul':
        for i in n:
            r*=i
        return r
    else:
        r = n[0]
        for i in range(1, len(n)):
            r/=n[i]
        return r
print(cal('add',1,2,3,4,5,6))
print(cal('sub',12,3,4,5,33))
print(cal('mul',1,2,3,4,5,6,7))
print(cal('div',100,2,5))
print('-----------')
def cal1(t,*n,ra):
    return cal(t,*n)*ra
print(cal1('add',1,2,3,4,5,6,ra=3))
print(cal1('sub',12,3,4,5,33,ra=2))
print(cal1('mul',1,2,3,4,5,6,7,ra=4))
print(cal1('div',100,2,5,ra=4))

print('----------')
def cal3(t,*n,ra=4):
    return cal(t,*n)*ra
print(cal3('add',1,2,3,4,5,6))